/*
 * Copyright 2020 www.mytijian.com All right reserved. This software is the
 * confidential and proprietary information of www.mytijian.com ("Confidential
 * Information"). You shall not disclose such Confidential Information and shall
 * use it only in accordance with the terms of the license agreement you entered
 * into with www.mytijian.com.
 */
package com.mytijian.task.zookeeper;

public class ZookeeperConfig {
    private static final String DEFAULT_HOST = "localhost";
    private static final int DEFAULT_PORT = 2181;

    private String nameSpace;
    private String hostName = DEFAULT_HOST;
    private int port = DEFAULT_PORT;
    public void setConnectionString(String connectionString) {
        if (connectionString.contains(":")) {
            String[] strings = connectionString.split(":");
            hostName = strings[0];
            port = Integer.parseInt(strings[1]);
            return;
        }
        hostName = connectionString;

    }
    public String getConnectionString() {
        return hostName + ":" + port;
    }
    public String getNameSpace() {
        return nameSpace;
    }

    public void setNameSpace(String nameSpace) {
        this.nameSpace = nameSpace;
    }

    public String getHostName() {
        return hostName;
    }

    public void setHostName(String hostName) {
        this.hostName = hostName;
    }

    public int getPort() {
        return port;
    }

    public void setPort(int port) {
        this.port = port;
    }
}
